﻿using BLL;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace library_managerment
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Userinfomanager manager = new Userinfomanager();
            Userinfo user = manager.Checklogin(username.Text, userpwd.Text);
            if (user == null)
            {
                username.BorderColor = System.Drawing.Color.Red;
                userpwd.BorderColor = System.Drawing.Color.Red;
                username.Text = "";
                userpwd.Text = "";
            }
            else {
                if (user.type == "admin")
                {
                    Response.Redirect("adminindex.aspx");
                }
                else {
                    
                }
            }
        }

        protected void Register_Click(object sender, EventArgs e)
        {
            Response.Redirect("Register.aspx");
        }
    }
}